package com.rpc.protocol;

import org.nustaq.serialization.FSTConfiguration;

import java.io.Serializable;

/**
 * @author yangzhuoleo
 * @Description ${Description}
 * @create 2018-01-17 22:52
 **/
public class FstSerializeImpl implements ISerialize {

    static FSTConfiguration configuration = FSTConfiguration.createDefaultConfiguration();

    @Override
    public <T> byte[] serialize(T transportData) {
        return configuration.asByteArray(transportData);
    }

    @Override
    public <T> T deserialize(byte[] data, Class<T> objectClass) {
        return (T) configuration.asObject(data);
    }
}
